using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Bifrost;

namespace TextEditor
{
    public class A_InsertKnowledge : A_Action
    {
        public frKnowledge knowledge;

        public override string ActionName()
        {
            return "insertknowledge";
        }

        public override bool Execute()
        {
            if (knowledge == null)
            {
                knowledge = new frKnowledge(base.myOwnerDocument);
                //App.FormStytleSet(knowledge);
            }
            knowledge.Visible = true;
            knowledge.mySelect = null;
            knowledge.Focus();
            knowledge.enable();
            knowledge.setLoadNode();
            base.myOwnerDocument.OwnerControl.knowledge = knowledge;
            return true;
        }

        //public override bool UIExecute()
        //{         
        //    ZYPopList se = new ZYPopList();
        //    se.Visible = true;            
        //    se.Focus();
        //    se.MyOwnerDocument = base.myOwnerDocument;
        //    se.MyOwnerDocument.OwnerControl.PopList = se;
        //    // base.myOwnerDocument._InsertMedicineForm();
        //    return true;
        //}

        public override bool isEnable()
        {
            return base.OwnerDocument.Us.InpatientInfo == null;
            //return base.myOwnerDocument.CanModify();
        }

        public override bool TestHotKey(Keys vKeyCode, bool vShift, bool vControl, bool vAlt)
        {
            if (vShift)
            {
                vKeyCode |= Keys.Shift;
            }
            if (vControl)
            {
                vKeyCode |= Keys.Control;
            }
            if (vAlt)
            {
                vKeyCode |= Keys.Alt;
            }
            return ((vKeyCode == (Keys.Control | Keys.K)) || (vKeyCode == Keys.F8));
        }
    }
}
